<div class="float-login-box hidden" data-login="{user_helper::get_user_id()}">
  <div class="login-box">
    <a href="javascript:void(0);" class="close"></a>
    <div class="login-inner">
      <div class="input-box">
        <div class="txt-box">
          <p class="txt-wrap1 clearfix"><input type="text" placeholder="用户名/邮箱/手机号" id="username" class="txt1"/><span class="prompt hidden"><i class="false-icon"></i></span></p>
          <p class="txt-wrap1 clearfix"><input type="password" placeholder="密码" id="password" class="txt1"/><span class="prompt hidden"><i class="false-icon"></i></span></p>
        </div>
        <p><a href="javascript:void(0);" id="jsLoginBoxBtn" class="btn2 login-btn clearfix">立即登录</a></p>
        <p class="clearfix"><label class="label1"><input type="checkbox" id="remember"/>两周内自动登录</label><a href="{AnUrl('user/getback/get_back')}" class="forget-pwd">忘记密码</a></p>
        <p><a href="{AnUrl('user/register')}" class="btn1 register-btn clearfix">注册NBD账号</a></p>
        <p class="lx-login"><a href="{AnUrl('openapi/lenovo/index')}">联想通行证登录</a></p>
      </div>
      <div class="other-login">
        <p class="tit"><span class="middle">合作账号登录</span></p>
        <div class="social">
          <a href="{AnUrl('openapi/sinaweibo/index')}" class="sina"></a>
          <a href="{AnUrl('openapi/qqconnect/login')}" class="qq qqhl"></a>
          <a href="{AnUrl('openapi/baiduconnect/login')}" class="baidu"></a>
          <a href="{AnUrl('openapi/weixin/web/login')}" class="weixin"></a>
        </div>
      </div>
    </div>
  </div>
</div>
<script>
function tollyRfUrl(rfUrl) {
  var sina = $('.sina').attr('href');
  var qq   = $('.qqhl').attr('href');
  var baidu = $('.baidu').attr('href');
  $('.sina').attr('href', sina+'?rfUrl='+rfUrl);
  $('.qqhl').attr('href', qq+'?rfUrl='+rfUrl);
  $('.baidu').attr('href', baidu+'?rfUrl='+rfUrl);
}
$(function(){
  $("#username, #password").keydown(function(e){ 
    var curKey = e.which; 
    if(curKey == 13){ 
      $("#jsLoginBoxBtn").click(); 
      return false; 
    }
  }); 
  $('.float-login-box .close').click(function(){
    $('.black-shade').trigger('click');
  });
  $('.login-inner .prompt').click(function(){
    $(this).hide();
  });
  $('.black-shade').click(function(){
    $(this).hide();
    $('.float-er-code').hide();
    $('.float-login-box').hide();
  });
  var rfUrl;
//登录login浮层
  $('.checkLoginBox').click(function(){
     var user_id = $('.float-login-box').data('login');
     rfUrl = $(this).data('url');
     if(typeof(rfUrl) != 'undefined'){
       tollyRfUrl(rfUrl);
     } else {
       rfUrl = '';
     }
     if(user_id <= 0) {
       $('.float-login-box').show();
       $('.black-shade').show();
     }
  });

  $('#jsLoginBoxBtn').click(function(){
      if(typeof(rfUrl) == 'undefined' || rfUrl == ''){
         rfUrl = $('.float-login-box').data('url');
       }
     $('#jsLoginBoxBtn').html('正在登录...');
     var username = $.trim($('#username').val());
     var password = $.trim($('#password').val());
     var remember = $('#remember').val();
     var iconHtml = '<i class="false-icon"></i>';
     if(username == '') {
       $('#username').next().show().html(iconHtml + '用户名不能为空');
       $('#jsLoginBoxBtn').html('立即登录');
       return;
     }
     if(password == '') {
       $('#password').next().show().html(iconHtml + '密码不能为空');
       $('#jsLoginBoxBtn').html('立即登录');
       return;
     }
     
    $.post(
         "{AnUrl('user/login/check_login')}",
         { "username" : username, "password":password, "remember":remember, 'logintype':'loginbox', 'rfUrl':rfUrl },
         function(data){
           if(data.info == 'error') {
             if(data.type == 'user') {
               $('#password').next().show().html(iconHtml + data.msg);
               $('#jsLoginBoxBtn').html('立即登录');
               return;
             } else {
               $('#password').next().show().html(iconHtml + data.msg);
               $('#jsLoginBoxBtn').html('立即登录');
               return;
             }
           } else {
              $('body').append(data.info);
           }
         },'json');
   })
});
</script>